<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 1.解构的回顾
    const obj = { name: "why" }
    const { name = 'kobe', age = 18 } = obj
    console.log(name, age)

    // 2.函数的默认值是一个对象
    function foo(obj = { name: "why", age: 18 }) {
      console.log(obj.name, obj.age)
    }
    foo()

    function foo1({ name, age } = { name: "why", age: 18 }) {
      console.log(name, age)
    }
    foo1()

    function foo2({name = "why", age = 18} = {}) {
      console.log(name, age)
    }
    foo2()

  </script>
</body>

</html>